//
//  XJYNavigationController.m
//  ShopMall
//
//  Created by XJY on 17/1/17.
//  Copyright © 2017年 XinJinYing. All rights reserved.
//

#import "XJYNavigationController.h"

@interface XJYNavigationController ()

@end

@implementation XJYNavigationController

+ (void)initialize
{
    UINavigationBar *naviBar = [UINavigationBar appearance];
    
    [naviBar setBackgroundImage:[UIImage imageNamed:@"nav_backImage"] forBarMetrics:UIBarMetricsDefault];
    
    [naviBar setTitleTextAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:20.0f weight:2], NSForegroundColorAttributeName : [UIColor blackColor]}];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.childViewControllers.count) {
        UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"详情界面返回按钮"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(backViewController)];
        viewController.navigationItem.leftBarButtonItem = backItem;
        viewController.hidesBottomBarWhenPushed = YES;
        
    }
    [super pushViewController:viewController animated:animated];
}

- (void)backViewController
{
    [self popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
